package com.itheima.sc.impl.pms;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.sc.api.pms.ProductAttributeValueApi;
import com.itheima.sc.mapper.pms.ProductAttributeValueMapper;
import com.itheima.sc.pojo.pms.ProductAttributeValue;
import org.apache.dubbo.config.annotation.DubboService;

import java.util.List;

@DubboService
public class ProductAttributeValueImpl extends ServiceImpl<ProductAttributeValueMapper, ProductAttributeValue> implements ProductAttributeValueApi {
    @Override
    public List<ProductAttributeValue> getByPid(Integer id) {
        LambdaQueryWrapper<ProductAttributeValue> wrapper = new LambdaQueryWrapper<ProductAttributeValue>().eq(ProductAttributeValue::getProductId, id);
        return list(wrapper);
    }

    @Override
    public void removeByPid(Integer pid) {
        LambdaQueryWrapper<ProductAttributeValue> wrapper = new LambdaQueryWrapper<ProductAttributeValue>().eq(ProductAttributeValue::getProductId, pid);
        remove(wrapper);
    }
}
